#include "src/misc.h"
#include <iostream>
#include <cstdlib>
using namespace std;
using namespace cv;

RNG rng(time(0));
Mat backGround;
TGPolygon polygon1, polygon2, polygon3;
Scalar c1(255, 0, 0), c2(0, 255, 0);


void onMouse(int event, int x, int y, int flags, void* param) {
    if(event == EVENT_LBUTTONDOWN) {
        bool flag = polygon1.isContainPoint({1.0*x, 1.0*y});
        //cout << x << " " << y << " " << flag << endl;
    }
}

int main() {
    vector<TGPoint> points;
    TGPolygon polygon;
    generateRandomPointSet(10, rng, points);
    findConvexHullWithGraham(points, polygon);
    backGround = Mat(1000, 1000, CV_8UC3, Scalar(255, 255, 255));
    drawPoints(backGround, c2, points);
    drawPolygon(backGround, polygon, c1, false);
    setMouseCallback("Main", onMouse);
    waitKey(0);
    destroyAllWindows();
    
    return 0;
}